Release 10.1A: OpenEdge Development:
Programming Interfaces
Event-driven exchanges
In an event-driven exchange, the DDE server application sends the value of the data item to the client whenever the value of the data item changes. Each server data item you set up for event-driven exchange actually participates in a series of exchanges, totally dependent on how often the data item changes. If the data item never changes value, no exchange occurs.
Steps to setting up event-driven exchanges—advise links
This section describes how to set up event-driven exchanges.
![]()
To set up and manage event-driven exchanges for a data item:
- Specify the server data item in a
DDE ADVISEstatement, using theSTARToption. This creates an advise link to the data item from Progress. From this point in the procedure, the DDE server monitors the specified data item, notifying Progress whenever its value changes.Note: In general, do not block for I/O (for example, invoke an- Add an
ON DDE-NOTIFY OF FRAMEDDEframestatement, whereDDEframeis the name of the frame that owns the conversation. In the trigger block for the statement, invoke theDDE GETstatement to retrieve the new value of the data item (just like aDDE REQUEST) and process it as you want. Progress triggers thisDDE-NOTIFYevent and posts it to the appropriate DDE frame when notified of the value change. The OpenEdge client application then executes the event trigger when it blocks for I/O or invokes thePROCESS EVENTSstatement. If you have more than one advise link established for the conversation, you can determine what data item changed by checking the value of theDDE-ITEMattribute of the DDE frame.UPDATEstatement) or invoke aPROCESS EVENTSstatement within the trigger for aDDE-NOTIFYevent. This can cause Progress to update the DDE frame attributes for a newDDE-NOTIFYevent before you have completed the processing for a prior event.- At any point in the procedure, if you want to stop event-driven exchanges for the data item, specify the data item in a
DDE ADVISEstatement using theSTOPoption. This removes the advise link and directs the server to cease monitoring value changes in the data item. This does not terminate the conversation in any way and you can continue to access the data item with other exchanges or create another advise link to the data item.Coordinating DDE client/server communications
If you use event-driven exchanges, you might also want to set a value for the
MULTITASKING-INTERVALattribute of theSESSIONsystem handle. The value of this attribute determines how often Progress checks for application events. An appropriate value can help your client application interact more smoothly with its DDE server. For more information, see the OpenEdge Development: Progress 4GL Reference .Applications for event-driven exchanges
You might use event-driven exchanges to tie data item values in a OpenEdge application to those in a spreadsheet, calender scheduler, or some other database application that might be running in your application environment. For example, the following code fragment retrieves the latest value of the cell at row 4, column 2 (the “B” column) in an Excel worksheet and stores it in a Progress editor field:
Multiple conversations with advise links
If a DDE frame owns more than one conversation with advise links, you can get the channel number of the conversation and the name of the data item to which a
DDE-NOTIFYevent applies from theDDE-IDandDDE-ITEMattributes of the frame. This is enough information to retrieve the value that triggered the event with theDDE GETstatement. However, you might also need the application and topic names to fully identify the item from which you are retrieving data. This is necessary if the different conversations (different topics and/or applications) include links to data items with the same name. You can obtain the application and topic names related to the currentDDE-NOTIFYevent from theDDE-NAMEandDDE-TOPICattributes of the frame. For more information on DDE frame attributes, see the "Defining conversation endpoints—DDE frames" section.However, you might find it simpler to manage event-driven exchanges by using a separate DDE frame for each advise link. In this case, you initiate an additional conversation for each advise link that you want to establish for the same application and topic, using a separate DDE frame for each conversation. You then set up each advise link using its own conversation ID. When a
DDE-NOTIFYevent occurs for a linked data item, you do not have to check for the source of the event, because each data item has its own frame trigger. The following code fragment shows the essential elements of this technique to link two data cells in the same Excel worksheet to two Progress variables (quote1andquote2):
|
Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |